from django.db import models


# 茶叶类型
class TypeTea(models.Model):
    tea_name = models.CharField(max_length=20, verbose_name="茶叶种类")
    isDel = models.CharField(max_length=1, verbose_name="是否删除")

    class Meta:
        db_table = "tea_type"
        verbose_name = "茶叶分类"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.tea_name


# 茶叶
class Home(models.Model):
    tea_chinese = models.CharField(max_length=20, verbose_name="中文名")
    tea_origin = models.CharField(max_length=30, verbose_name="起源年限")
    tea_effect = models.CharField(max_length=400, verbose_name="主要食用功效和营养成分")
    tea_storage = models.CharField(max_length=400, verbose_name="储藏方法")
    tea_fabrication = models.CharField(max_length=400, verbose_name="制作工艺")
    tea_place = models.CharField(max_length=20, verbose_name="产地")
    tea_maketeastep = models.TextField(max_length=1000, verbose_name="泡茶步骤")
    tea_image = models.CharField(max_length=255, verbose_name="茶叶图片")
    tea_type_id = models.ForeignKey("Typetea", on_delete=models.CASCADE)
    isDel = models.CharField(max_length=1, verbose_name="是否删除")

    class Meta:
        db_table = "tea"
        verbose_name = "茶叶"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.tea_chinese


# 茶具
class ChaJu(models.Model):
    name = models.CharField(max_length=255, verbose_name="茶具名字")
    # 适用
    apply = models.CharField(max_length=255, verbose_name="茶具适用详情")
    # 工艺
    technology = models.CharField(max_length=255, verbose_name="茶具工艺详情")
    # 简史
    brief_history = models.CharField(max_length=255, verbose_name="茶具简史详情")
    isDel = models.CharField(max_length=1, verbose_name="是否删除")

    class Meta:
        db_table = "tea_set"
        verbose_name = "茶具"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name


# 茶史
class ChaShi(models.Model):
    time = models.CharField(max_length=255, verbose_name="历史时间")
    # 简介
    synopsis = models.TextField(max_length=255, verbose_name="历史简介")
    # 历史朝代
    dynasty = models.CharField(max_length=255, verbose_name="历史朝代")
    # 历史图片
    history_img = models.CharField(max_length=255, verbose_name="历史图片")
    isDel = models.CharField(max_length=1, verbose_name="是否删除")

    class Meta:
        db_table = "tea_history"
        verbose_name = "茶史"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.time


# 茶席
class TeaSpace(models.Model):
    headline = models.CharField(max_length=255, verbose_name="标题")
    textContent = models.CharField(max_length=255, verbose_name="内容")
    image = models.CharField(max_length=255, verbose_name="图片")

    class Meta:
        db_table = "tea_space"
        verbose_name = "茶席"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.headline


# 茶典
class TeaCeremony(models.Model):
    text = models.CharField(max_length=255, verbose_name="内容")
    isDel = models.CharField(max_length=1, verbose_name="是否删除")

    class Meta:
        db_table = "tea_ceremony"
        verbose_name = "茶典"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.text
